var readline = require('readline-sync')
readline.setDefaultOptions({ prompt: '' })
var readline = readline.prompt
function getData (array) {
  let result = []
  for (let i = 0; i < array.length; i++) {
    if (array[i] % 3 === 0 && array[i] % 2 === 0) {
      result.push(array[i])
    }
  }
  return result
}
// [7,9,18,32,43,57,66,81] 是个字符串
let array = readline().split(',') // 得到的是一个数组
let arr0 = array[0]
let arr0Arr = arr0.split('')
arr0Arr.shift()
array[0] = arr0Arr.join('')
let arrLast = array[array.length - 1]
let arrLastArr = arrLast.split('')
arrLastArr.pop()
array[array.length - 1] = arrLastArr.join('')
let res = getData(array)
// res是一个数组 
let str = ''
for (let i = 0; i < res.length; i++) {
  if (i !== res.length - 1) {
    str += (res[i] + ', ')
  } else {
    str += res[i]
  }
}
console.log('[ ' + str + ' ]')